package tx.bj12320.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bj12320.model.*;
import tx.bj12320.dao.*;
import tx.bj12320.service.*;
import tx.bj12320.vo.query.*;

@Service
@Transactional
public class ActivityInfoManager extends BaseManager<ActivityInfo,Long>{

	private ActivityInfoDao activityInfoDao;
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	public void setActivityInfoDao(ActivityInfoDao dao) {
		this.activityInfoDao = dao;
	}
	public EntityDao getEntityDao() {
		return this.activityInfoDao;
	}

	@Transactional(readOnly=true)
	public Page findPage(ActivityInfoQuery query) {
		return activityInfoDao.findPage(query);
	}

	/**
	 * 获取某个流程最后的一个环节信息
	 * @param tszbProcessInfoId
	 * @return
	 */
	@Transactional(readOnly=true)
	public ActivityInfo getLastActivityInfo(Long tszbProcessInfoId) {
		ActivityInfoQuery query=new ActivityInfoQuery();
		query.setTszbProcessInfoId(tszbProcessInfoId);
		query.setSortColumns("activityInfoId desc");
		query.setPageSize(1);
		Page p= activityInfoDao.findPage(query);
		if(p.getResult().size()>0){
			return (ActivityInfo)p.getResult().get(0);
		}else{
			return null;
		}
	}

}
